﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Tools
{
    public partial class StringSpitForm : UserControl
    {
        public StringSpitForm()
        {
            InitializeComponent();
        }

        private void submit_Click(object sender, EventArgs e)
        {
            string spitStr = spitTextBox.Text;
            string result = "";
            if (contentTextBox.Text != null && contentTextBox.Text.Length>0) {
                string[] lines= contentTextBox.Text.Split('\n');
                foreach (var item in lines)
                {
                    string[] keys = item.Replace("\r\n", "").Replace("\n", "").Replace("\r", "").Split(new string[] { spitStr }, StringSplitOptions.None);
                    foreach (var item1 in keys)
                    {
                        result = result + item1 + "\r\n";
                    }

                }
                contentTextBox.Text = result;
            }

        }

        private void clear_Click(object sender, EventArgs e)
        {
            spitTextBox.Text = "&";
            contentTextBox.Text = "";
        }
    }
}
